﻿// SNSettingDlg.cpp: 实现文件
//

#include "pch.h"
#include "ProjectAA.h"
#include "SNSettingDlg.h"
#include "afxdialogex.h"


// CSNSettingDlg 对话框

IMPLEMENT_DYNAMIC(CSNSettingDlg, CDialogEx)

CSNSettingDlg::CSNSettingDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_SNSETTING, pParent)
	, Msg1(_T(""))
	, Msg2(_T(""))
	, Msg3(_T(""))
	, Msg4(_T(""))
	, Msg5(_T(""))
	, Msg6(0)
	, SNChoose0(0)
	, SNChoose1(0)
	, SNChoose2(0)
	, SNChoose3(0)
	, SNChoose4(0)
	, SNChoose5(0)
	, SNChoose6(0)
	, SNChoose7(0)
	, SNChoose8(0)
	, SNFlag0(FALSE)
	, SNFlag1(FALSE)
	, SNFlag2(FALSE)
	, SNFlag3(FALSE)
	, SNFlag4(FALSE)
	, SNFlag5(FALSE)
	, SNFlag6(FALSE)
	, SNFlag7(FALSE)
	, SNFlag8(FALSE)
	, PassPrintFlag(FALSE)
	, UploadSNFlag(FALSE)
{

}

CSNSettingDlg::~CSNSettingDlg()
{
}

void CSNSettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, Msg1);
	DDX_Text(pDX, IDC_EDIT2, Msg2);
	DDX_Text(pDX, IDC_EDIT3, Msg3);
	DDX_Text(pDX, IDC_EDIT4, Msg4);
	DDX_Text(pDX, IDC_EDIT6, Msg5);
	DDX_Text(pDX, IDC_EDIT7, Msg6);
	DDX_CBIndex(pDX, IDC_COMBO1, SNChoose0);
	DDX_CBIndex(pDX, IDC_COMBO3, SNChoose1);
	DDX_CBIndex(pDX, IDC_COMBO4, SNChoose2);
	DDX_CBIndex(pDX, IDC_COMBO5, SNChoose3);
	DDX_CBIndex(pDX, IDC_COMBO6, SNChoose4);
	DDX_CBIndex(pDX, IDC_COMBO7, SNChoose5);
	DDX_CBIndex(pDX, IDC_COMBO8, SNChoose6);
	DDX_CBIndex(pDX, IDC_COMBO9, SNChoose7);
	DDX_CBIndex(pDX, IDC_COMBO10, SNChoose8);
	DDX_Check(pDX, IDC_CHECK5, SNFlag0);
	DDX_Check(pDX, IDC_CHECK8, SNFlag1);
	DDX_Check(pDX, IDC_CHECK9, SNFlag2);
	DDX_Check(pDX, IDC_CHECK10, SNFlag3);
	DDX_Check(pDX, IDC_CHECK11, SNFlag4);
	DDX_Check(pDX, IDC_CHECK12, SNFlag5);
	DDX_Check(pDX, IDC_CHECK13, SNFlag6);
	DDX_Check(pDX, IDC_CHECK14, SNFlag7);
	DDX_Check(pDX, IDC_CHECK15, SNFlag8);
	DDX_Check(pDX, IDC_CHECK16, PassPrintFlag);
	DDX_Check(pDX, IDC_CHECK18, UploadSNFlag);
}


BEGIN_MESSAGE_MAP(CSNSettingDlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &CSNSettingDlg::OnBnClickedButton1)
END_MESSAGE_MAP()


// CSNSettingDlg 消息处理程序


BOOL CSNSettingDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	Msg1 = gSystemMgr.Msg1;
	Msg2 = gSystemMgr.Msg2;
	Msg3 = gSystemMgr.Msg3;
	Msg4 = gSystemMgr.Msg4;
	Msg5 = gSystemMgr.Msg5;
	Msg6 = gSystemMgr.Msg6;

	SNChoose0 = gSystemMgr.SNChoose[0];
	SNChoose1 = gSystemMgr.SNChoose[1];
	SNChoose2 = gSystemMgr.SNChoose[2];
	SNChoose3 = gSystemMgr.SNChoose[3];
	SNChoose4 = gSystemMgr.SNChoose[4];
	SNChoose5 = gSystemMgr.SNChoose[5];
	SNChoose6 = gSystemMgr.SNChoose[6];
	SNChoose7 = gSystemMgr.SNChoose[7];
	SNChoose8 = gSystemMgr.SNChoose[8];

	SNFlag0 = gSystemMgr.SNFlag[0];
	SNFlag1 = gSystemMgr.SNFlag[1];
	SNFlag2 = gSystemMgr.SNFlag[2];
	SNFlag3 = gSystemMgr.SNFlag[3];
	SNFlag4 = gSystemMgr.SNFlag[4];
	SNFlag5 = gSystemMgr.SNFlag[5];
	SNFlag6 = gSystemMgr.SNFlag[6];
	SNFlag7 = gSystemMgr.SNFlag[7];
	SNFlag8 = gSystemMgr.SNFlag[8];

	PassPrintFlag = gSystemMgr.PassPrintFlag;
	UploadSNFlag = gSystemMgr.UploadSNFlag;

	UpdateData(FALSE);
	return TRUE;
}


void CSNSettingDlg::OnCancel()
{
	// TODO: 在此添加专用代码和/或调用基类

	CDialogEx::OnCancel();
}


void CSNSettingDlg::OnBnClickedButton1()
{
	UpdateData(TRUE);
	gSystemMgr.Msg1 = Msg1;
	gSystemMgr.Msg2 = Msg2;
	gSystemMgr.Msg3 = Msg3;
	gSystemMgr.Msg4 = Msg4;
	gSystemMgr.Msg5 = Msg5;
	gSystemMgr.Msg6 = Msg6;

	gSystemMgr.SNChoose[0] = SNChoose0;
	gSystemMgr.SNChoose[1] = SNChoose1;
	gSystemMgr.SNChoose[2] = SNChoose2;
	gSystemMgr.SNChoose[3] = SNChoose3;
	gSystemMgr.SNChoose[4] = SNChoose4;
	gSystemMgr.SNChoose[5] = SNChoose5;
	gSystemMgr.SNChoose[6] = SNChoose6;
	gSystemMgr.SNChoose[7] = SNChoose7;
	gSystemMgr.SNChoose[8] = SNChoose8;

	gSystemMgr.SNFlag[0] = SNFlag0;
	gSystemMgr.SNFlag[1] = SNFlag1;
	gSystemMgr.SNFlag[2] = SNFlag2;
	gSystemMgr.SNFlag[3] = SNFlag3;
	gSystemMgr.SNFlag[4] = SNFlag4;
	gSystemMgr.SNFlag[5] = SNFlag5;
	gSystemMgr.SNFlag[6] = SNFlag6;
	gSystemMgr.SNFlag[7] = SNFlag7;
	gSystemMgr.SNFlag[8] = SNFlag8;

	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg1", gSystemMgr.Msg1);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg2", gSystemMgr.Msg2);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg3", gSystemMgr.Msg3);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg4", gSystemMgr.Msg4);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg5", gSystemMgr.Msg5);

	gSystemMgr.PassPrintFlag = PassPrintFlag;
	gSystemMgr.UploadSNFlag = UploadSNFlag;

	CString cstr;
	cstr.Format(L"%d", gSystemMgr.PassPrintFlag);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"PassPrintFlag", cstr);
	cstr.Format(L"%d", gSystemMgr.UploadSNFlag);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"UploadSNFlag", cstr);

	cstr.Format(L"%d", gSystemMgr.Msg6);
	gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"Msg6", cstr);

	cstr.Format(L"%d", gSystemMgr.SNChoose[0]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[1]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[2]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[3]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[3]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[4]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[4]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[5]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[5]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[6]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[6]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[7]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[7]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNChoose[8]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNChoose[8]", cstr);

	cstr.Format(L"%d", gSystemMgr.SNFlag[0]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[1]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[2]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[3]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[3]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[4]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[4]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[5]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[5]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[6]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[6]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[7]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[7]", cstr);
	cstr.Format(L"%d", gSystemMgr.SNFlag[8]); gSystemMgr.m_cLoginConfigIni.SaveConfigIni(L"SN", L"SNFlag[8]", cstr);

}
